/*
 * $Id: FooActionBean.java 77 2011-02-07 06:11:38Z samaxes $
 *
 * Copyright 2010 samaxes.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.samaxes.stripes.action;

import net.sourceforge.stripes.action.ActionBean;
import net.sourceforge.stripes.action.ActionBeanContext;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.DontValidate;
import net.sourceforge.stripes.action.Resolution;
import net.sourceforge.stripes.action.StreamingResolution;

import com.samaxes.stripes.ext.CustomActionBeanContext;

/**
 * Example action bean.
 * 
 * @author Samuel Santos
 * @version $Revision: 1.2 $
 */
public class FooActionBean implements ActionBean {

    private CustomActionBeanContext context;

    /**
     * Gets the context.
     * 
     * @return the context
     */
    public final CustomActionBeanContext getContext() {
        return context;
    }

    /**
     * Sets the context.
     * 
     * @param context the context to set
     */
    public final void setContext(ActionBeanContext context) {
        this.context = (CustomActionBeanContext) context;
    }

    /**
     * Goes to the example list page.
     * 
     * @return a character data stream to the client
     */
    @DontValidate
    @DefaultHandler
    public Resolution main() {
        return new StreamingResolution("text/plain", context.getFooService().greet("Earthlings"));
    }
}
